package com.power.sifa.correction.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 处置记录实体类
 */

@Entity
@ApiModel(value = "处置记录")
@Data
@Table(name = "Cre_work_record", schema = "sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Cre_work_record.Cre_work_recordPK.class) 用于复合组件
public class Cre_work_record extends BaseModel implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @ApiModelProperty(value = "workid_tm")
    private String id;

    @ApiModelProperty(value = "记录时间", example = "2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date exectime;

    @ApiModelProperty(value = "处置记录")
    private String record;

    @ApiModelProperty(value = "处置附件")
    private String fileids;

    @ApiModelProperty(value = "记录人id")
    private String userid;

    @ApiModelProperty(value = "预警任务id")
    private String workid;

    @ApiModelProperty(value = "是否惩办")
    private Integer ispis = 3201;

    /**
     * 社矫人员id
     */
    @Transient
    private String perid;

    /**
     * 记录人名称
     */
    @Transient
    private String fullname;


    public Map<String, Object> parseMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", this.getId());
        map.put("exectime", this.getExectime());
        map.put("record", this.getRecord());
        map.put("userid", this.getUserid());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Cre_work_recordPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String) key;

        //Cre_work_recordPK pk = (Cre_work_recordPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
